﻿@model IEnumerable<FreightSoft.Models.CUSTOMER_ORDER>

@{
    Layout = "~/Views/Shared/Part_Layout.cshtml";
    decimal? total = 0;
}
<html>
<body>
    <table border="1">
        <tr>
            <th>Customer
            </th>
            <th>Invoice No
            </th>
            <th>Payment Received (USD)
            </th>

        </tr>

        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.CUSTOMER_ID) - 
            @Html.DisplayFor(modelItem => item.CUSTOMER.NAME)
                </td>
                <td>
                    @item.ORDER_ID
                </td>
                <td>
                    @item.ORDER_LINE.Sum(o => o.GROSS_AMOUNT)
                    @{total += item.ORDER_LINE.Sum(o => o.GROSS_AMOUNT);}
                </td>
            </tr>
        }

        <tr style="width: 205px">
            <td></td>
            <td>
                <b>Total:</b>
            </td>
            <td>
                @total
            </td>
        </tr>

    </table>
</body>
</html>
